<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    function getBalance() {
      let total = +prompt('请输入您的总金额')
      let a = +prompt('请输入您的消费金额')
      return total - a;
    }
  </script>
</body>

</html>